package com.yhb.channel.impl.Scalable;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.yhb.channel.utils.ChannelJSONUtil;
import lombok.var;

import java.util.HashMap;

public class CardBalance {
    public String cardNumber;
    public String balance;

    @JsonIgnore
    public static void main(String[] args) {
        var row = "{\"balanceList\":[{\"balance\":\"111\",\"cardNumber\":\"222\"}," +
                "{\"balance\":\"333\",\"cardNumber\":\"444\"}]}";
        var res = ChannelJSONUtil.parseJson(row, HashMap.class);
        var balanceList = ChannelJSONUtil.parseJson(ChannelJSONUtil.toJson(res.get("balanceList")), CardBalance[].class);
        for (var cardBalance: balanceList) {
            var balance = cardBalance.balance;
            var cardNumber = cardBalance.cardNumber;
            System.out.println(balance);
            System.out.println(cardNumber);
        }
    }
}
